﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Threading.Tasks;



class BunnyFactory
    {
        // 50 points in BG Coder
        // Needs Lists <int> instead of StringBuilder for larger than 9 input digits

        static void Main(string[] args)
        {
            string input = "";
            StringBuilder cages = new StringBuilder();
            while (input != "END")
            {
                cages.Append(input);
                input = Console.ReadLine();
            }

            input = cages.ToString();
            cages.Clear();

            StringBuilder resultCycle = new StringBuilder();
            List<int> sCages = new List<int>();
            int s = 0;


            for (int i = 0; i < input.Length ; i++)
            {
                for (int k = 0; k <= i; k++)
                {
                    s += input[k] - '0';

                }

                if (s >= input.Length - i)
                {
                    break;
                }

                for (int j = i + 1; j <= i + s; j++)
                {
                    int sNumbers = input[j] - '0';
                    sCages.Add(sNumbers);

                }
                    BigInteger sum = CalcSum(sCages);
                    BigInteger product = CalcProduct(sCages);
                    sCages.Clear();
                    resultCycle.Append(sum);
                    resultCycle.Append(product);
                   
                    resultCycle.Append(input, s + 1 + i, input.Length - 1 - s - i);
                    input = ExcludeZerosAndOnes(resultCycle);
                    s = 0;
                    resultCycle.Clear();
            }

            PrintResult(input);
            
        }

        static void PrintResult(string input)
        {
            StringBuilder result = new StringBuilder();
            for (int i = 0; i < input.Length; i++)
            {
                result.Append(input[i]);
                result.Append(' ');
            }
            Console.WriteLine(result.ToString().Trim()); 
        }

        static string ExcludeZerosAndOnes(StringBuilder resultCycle)
        {
            for (int i = 0; i < resultCycle.Length; i++)
            {
                if (resultCycle[i] == '0' || resultCycle[i] == '1')
                {
                    resultCycle.Remove(i, 1);
                    i--;
                }
                
            }
            return resultCycle.ToString();

        }

        static BigInteger CalcProduct(List<int> sCages)
        {
            BigInteger product = 1;
            foreach (int cage in sCages)
            {
                product *= cage;
            }
            return product;

        }

        static BigInteger CalcSum(List<int> sCages)
        {
            BigInteger sum = 0;
            foreach (int cage in sCages)
            {
                sum += cage;

            }
            return sum;
        }
    }

